/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.lacibMusic.entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author AlanmLira
 */
@Entity
@Table(name = "Selo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Selo.findAll", query = "SELECT s FROM Selo s"),
    @NamedQuery(name = "Selo.findById", query = "SELECT s FROM Selo s WHERE s.id = :id"),
    @NamedQuery(name = "Selo.findByNomeSelo", query = "SELECT s FROM Selo s WHERE s.nomeSelo = :nomeSelo")})
public class Selo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Size(max = 50)
    @Column(name = "nomeSelo")
    private String nomeSelo;
    @JoinColumn(name = "Gravadora_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Gravadora gravadoraid;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "seloid")
    private List<Album> albumList;

    public Selo() {
    }

    public Selo(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNomeSelo() {
        return nomeSelo;
    }

    public void setNomeSelo(String nomeSelo) {
        this.nomeSelo = nomeSelo;
    }

    public Gravadora getGravadoraid() {
        return gravadoraid;
    }

    public void setGravadoraid(Gravadora gravadoraid) {
        this.gravadoraid = gravadoraid;
    }

    @XmlTransient
    public List<Album> getAlbumList() {
        return albumList;
    }

    public void setAlbumList(List<Album> albumList) {
        this.albumList = albumList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Selo)) {
            return false;
        }
        Selo other = (Selo) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.lacibMusic.entidades.Selo[ id=" + id + " ]";
    }
    
}
